<?php

namespace app\common\service\goods\source;

use app\common\model\BoxCollect;
use app\common\model\entrust\Goods as EntrustGoodsModel;

class Entrust extends Basics
{

    public function updateGoodsStock($goodsList)
    {
        // TODO: Implement updateGoodsStock() method.
    }

    public function updateStockSales($goodsList)
    {
        // TODO: Implement updateStockSales() method.
    }

    public function backGoodsStock($goodsList, bool $isPayOrder = false)
    {
        // TODO: Implement backGoodsStock() method.
    }

    public function goodsStatus($goodsList)
    {
        foreach ($goodsList as $value) {
            $goods         = EntrustGoodsModel::where('id', $value['goods_source_id'])->field('id,source_id,source')->find();
            $goods->status = EntrustGoodsModel::STATUS_ON;
            $goods->save();
            switch ($goods->source) {
                case 'box_collect':
                    BoxCollect::update(['entrust_status' => EntrustGoodsModel::STATUS_ON], ['collect_id' => $goods['source_id']]);
                    break;
                default:
                    break;
            }
        }
    }
}